package com.yjymm.controller;

import com.yjymm.domain.COVIDData;
import com.yjymm.domain.RegionData;
import com.yjymm.service.COVIDDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yjymm
 * @date 2020-05-09 16:59
 */

@RestController
@RequestMapping("/covid")
public class COVIDDataController {

    @Autowired
    private COVIDDataService service;

    @RequestMapping("/all")
    public COVIDData all(){
        return service.all();
    }


    @RequestMapping("/search/{query}")
    public List<RegionData> search(@PathVariable("query") String query)
    {
        return service.search(query);
    }

}
